
{extend name="base/base" /}
{block name="style"}
<style type="text/css">

</style>
{/block}
{block name="content"}
  <div class="layui-form-item layui-form-pane">
      <div class="layui-inline">
          <label class="layui-form-label">用户ID</label>
          <div class="layui-input-inline">
              <input type="text" name="uid" autocomplete="off" class="layui-input" id='uid'>
          </div>
      </div>
      <div class="layui-inline">
          <label class="layui-form-label">用户名</label>
          <div class="layui-input-inline">
              <input type="text" name="username" autocomplete="off" class="layui-input" id='username'>
          </div>
      </div>
     <!--  <div class="layui-inline">
          <label class="layui-form-label">电话</label>
          <div class="layui-input-inline">
              <input type="text" name="phone" autocomplete="off" class="layui-input" id='phone'>
          </div>
      </div> -->
 <!--      <div class="layui-inline">
          <label class="layui-form-label">收益时间</label>
          <div class="layui-input-inline">
              <input type="text" class="layui-input" name="start_time" id="start_time" placeholder="yyyy-MM-dd">
          </div>
          <div class="layui-form-mid">-</div>
          <div class="layui-input-inline">
              <input type="text" class="layui-input" name="end_time" id="end_time" placeholder="yyyy-MM-dd">
          </div>
      </div> -->
      <div class="layui-inline">
        <div class="demoTable">
          <button class="layui-btn" data-type="reload">搜索</button>
          <!-- <button class="layui-btn" onclick="excel()">导出表</button> -->
        </div>
      </div>
  <table id="table" lay-filter="table"></table> 

</div>
{/block}
{block name="script"}
<script>
layui.use(['table', 'laydate'], function(){
  var table = layui.table;
  var laydate = layui.laydate;
  table.render({
    elem: '#table'
    ,height: 'full-200'
    ,url: '/admin/invest/statisticsList/' //数据接口
    ,limit:20
    ,page: true //开启分页
    ,id:'reload'
    ,cols: [[ //表头
        {field:'uid', title: '用户ID', width: 100}
      // ,{field:'phone', title: '电话', width: 150}
      ,{field:'username', title: '用户名（地址）', width: 300}
      ,{field:'self', title: '自身业绩', width: 200}
      ,{field:'team', title: '团队业绩', width: 200}
      // ,{field:'team_profit', title: '社区收益', width: 200}
      // ,{field:'total_profit', title: '今日总收益', width: 200}
      // ,{field:'date', title: '收益时间', width: 200}
      // ,{field:'status', title: '收益备注', width: 200,templet: function(d){
      //   if (d.status == 1) {
      //     return '<span style="color:red">未领取</span>'
      //   }
      //   if (d.status == 2) {
      //     return '<span style="color:blue">已领取</span>'
      //   }
      // }}
    ]]
  });
    // 搜索
  var $ = layui.$, active = {
        reload: function(){
            table.reload('reload', {
                where: {
                    uid: $('#uid').val(),
                    username: $('#username').val(),
                    phone: $('#phone').val(),
                    // start_time: $('#start_time').val(),
                    // end_time: $('#end_time').val()
                }
            });
        }
    };
    $('.demoTable .layui-btn').on('click', function(){
    var type = $(this).data('type');
    active[type] ? active[type].call(this) : '';
  });
      //日期
  laydate.render({
    elem: '#start_time'
  });
  laydate.render({
    elem: '#end_time'
  });
});
function excel(){
  // var index = layer.msg('正在拼命处理...' , {
  //       icon: 16 ,
  //       shade: 0.6 ,
  //       time: 0 ,
  //     });
  var post_data = {
                    uid: $('#uid').val(),
                    username: $('#username').val(),
                    // phone: $('#phone').val(),
                    // start_time: $('#start_time').val(),
                    // end_time: $('#end_time').val()
                }
  $.ajax({
    url:"{:url('admin/out/excel')}",
    type:"POST",
    data:post_data,
    success:function(ret){
      //alert(ret);
      location.href='/'+ret;
    }
  }); 
}
</script>
{/block}
